﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="BankAccounts.aspx.cs" Inherits="Operator_BankAccounts" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

    <br />
    <asp:HyperLink ID="OperatorLink" runat="server" NavigateUrl="~/Operator/OperatorPanel.aspx">Панель оператора</asp:HyperLink> &nbsp;→ 
    <asp:HyperLink ID="OperatorClientLink" NavigateUrl="../Operator/Clients.aspx" runat="server">Клиенты</asp:HyperLink>
&nbsp; → 
    <b><asp:Label ID="ContractLabel" runat="server" Text="Счета клиента" ForeColor="black" Font-Bold="true"></asp:Label></b><br/>
<br />

<asp:GridView ID="BankAccountsGridView" runat="server" 
        AutoGenerateColumns="False" DataSourceID="SqlDataSourceBankAccounts"
        onrowdatabound="BankAccountsGridView_RowDataBound" 
        onselectedindexchanged="BankAccountsGridView_SelectedIndexChanged">
        <Columns>
            <asp:BoundField DataField="Номер счёта" HeaderText="Номер счёта" 
                SortExpression="Номер счёта" />
            <asp:BoundField DataField="Сумма" HeaderText="Сумма" SortExpression="Сумма" />
            <asp:BoundField DataField="Валюта" HeaderText="Валюта" 
                SortExpression="Валюта" />
                 <asp:TemplateField>
                            <ItemTemplate>
                            <asp:LinkButton ID="RefillBankAccountLinkButton" runat="server" OnClick="RefillBankAccountClicked">Пополнить</asp:LinkButton>
                            </ItemTemplate>
                            </asp:TemplateField>
            <asp:CommandField SelectText="Закрыть" ShowSelectButton="True" />
        </Columns>
        <EmptyDataTemplate>
            Счетов нет.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceBankAccounts" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
        SelectCommand="SELECT BankAccountCompany.BankAccountId AS [Номер счёта], BankAccount.Amount AS Сумма, Currency.Name AS Валюта FROM BankAccountCompany INNER JOIN BankAccount ON BankAccountCompany.BankAccountId = BankAccount.BankAccountId INNER JOIN Currency ON BankAccount.CurrencyId = Currency.CurrencyID WHERE (BankAccountCompany.CompanyId = @CompanyId)">
        <SelectParameters>
            <asp:SessionParameter Name="CompanyId" SessionField="companyId" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <asp:Button ID="CreateBankAccountButton" runat="server" 
        Text="Открыть новый счёт" onclick="CreateBankAccountButton_Click" />
</asp:Content>

